<template>
  <section class="h-screen">
    <div class="container mx-auto px-6 py-18 md:py-24 h-full">
      <div class="flex justify-center items-center flex-wrap h-full">
        <div class="w-full md:w-2/3 lg:w-6/12 mb-2 md:mb-12">
          <img
            :src="loginImg"
            class="w-full w-full object-cover"
            alt="Phone image"
          />
        </div>
        <div class="w-full md:w-1/3 lg:w-4/12 lg:ml-10">
          <login-form class="mb-8" @success="loginSuccess" />
        </div>
      </div>
    </div>
  </section>
</template>
<script lang="ts" setup>
import loginImg from "@/assets/login-amico.svg";

import { useUserStore } from "@/stores/user";
import { useRouter } from "vue-router";
import { User } from "@/components/types";

const store = useUserStore(),
  router = useRouter();
const loginSuccess = (user: User) => {
  store.login(user);
  // to todos
  router.push({ name: "todos" });
};
</script>
